﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BSCMFF.Core;

namespace BSCMFF.Web.Pages.Settings
{
    /// <summary>
    /// Change theme.
    /// </summary>
    /// <remarks></remarks>
    public partial class Themes : MultiLanguagePage
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HttpCookie cookie = Request.Cookies["Theme"];
                if (cookie != null)
                {
                    RadComboBoxTheme.SelectedValue = cookie.Value;
                }
                else
                {
                    RadComboBoxTheme.SelectedValue = "Windows7";
                }
            }
        }

        /// <summary>
        /// Handles the Changed event of the RadComboBoxTheme control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void RadComboBoxTheme_Changed(object sender, EventArgs e)
        {
            HttpCookie cookie = new HttpCookie("Theme");
            cookie.Value = RadComboBoxTheme.SelectedValue;
            Response.Cookies.Add(cookie);

            Response.Redirect(Request.Url.AbsolutePath);              
        }        
    }
}